import {request} from "../request";
import {utils} from "../../common/utils";
import store from "../../store";


export function addContactsGroup({groupName,empId}){
	return request({
		url: '/sys/contacts-groups/add',
		method: 'post',
		data:{
			groupName,
			empId
		}
	})
}

export function updateContactsGroup({id,groupName}){
	return request({
		url: '/sys/contacts-groups/update',
		method: 'put',
		data:{
			id,
			groupName
		}
	})
}

export function queryUserContactsGroup(){
	return request({
		url: '/sys/contacts-groups/query',
		method: 'get',
		params:{
			empId: store.state.loginUser.id
		}
	})
}

export function deleteUserContactsGroup({ids,empId}){
	let strUrl = utils.joinArrayReqParam(ids,'ids');
	return request({
		url: '/sys/contacts-groups/delete' + strUrl,
		method: 'delete',
		params: {
			empId
		}
	})
}

export function hasSameNameGroup({id,groupName}){
	return request({
		url: '/sys/contacts-groups/has-same-name',
		method: 'get',
		params:{
			id,
			groupName
		}
	})
}